home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
M2DOC.LZH
/
SIEVE.MOD
< prev
next >
Wrap
Text File
|
1987-06-21
|
873b
|
38 lines
MODULE sieve;
(* $R-, $T- *)
FROM InOut IMPORT Read, Write, WriteString, WriteCard, WriteLn;
CONST
SIZE = 8190;
ITER = 10;
VAR
flag :ARRAY [0..SIZE] OF BOOLEAN;
i, j, k, count, prime :CARDINAL;
ch :CHAR;
BEGIN
WriteString("Hit a key to start 10 ITERATIONS");
Read(ch); WriteLn;
FOR i := 1 TO ITER DO
count := 0;
FOR j := 0 TO SIZE DO
flag[j] := TRUE;
END;
FOR j := 0 TO SIZE DO
IF flag[j] THEN
prime := j+j+3;
k := j+prime;
WHILE k <= SIZE DO
flag[k] := FALSE;
INC(k,prime);
END;
INC(count);
END;
END;
END;
Write(7C); WriteCard(count,5);
END sieve.